<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 后台管理系统</title>
    <link href="./js/bootstrap.min.css" rel="stylesheet">
    <link href="./js/bootstrap-icons.css" rel="stylesheet">
    <link rel="stylesheet" href="./css/index.css">

    <script src="./js/chart.js"></script>

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8fafc;
        }

        /* 顶部导航栏 */
        .top-nav {
            height: 60px;
            background-color: #2563eb;
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }

        .logo {
            font-size: 20px;
            font-weight: bold;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .notification-icon {
            font-size: 20px;
            cursor: pointer;
        }

        .user-dropdown {
            position: relative;
            cursor: pointer;
        }

        /* 主体布局 */
        .main-container {
            display: flex;
            margin-top: 60px;
            height: calc(100vh - 60px);
        }

        /* 左侧菜单栏 */
        .sidebar {
            width: 220px;
            background-color: #1e293b;
            color: white;
            transition: all 0.3s;
            height: 100%;
            position: fixed;
            overflow-y: auto;
        }

        .sidebar.collapsed {
            width: 80px;
        }

        .menu-toggle {
            padding: 15px 20px;
            cursor: pointer;
            border-bottom: 1px solid #334155;
        }

        .menu-items {
            padding: 10px 0;
        }

        .menu-item {
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .menu-item:hover {
            background-color: #334155;
        }

        .menu-item.active {
            background-color: #2563eb;
        }

        .menu-text {
            white-space: nowrap;
            overflow: hidden;
        }

        .sidebar.collapsed .menu-text {
            display: none;
        }

        .sidebar.collapsed .menu-item {
            justify-content: center;
        }

        /* 内容区 */
        .content {
            flex: 1;
            margin-left: 220px;
            padding: 20px;
            transition: margin-left 0.3s;
        }

        .sidebar.collapsed ~ .content {
            margin-left: 80px;
        }

        /* 数据卡片 */
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 20px;
            margin-bottom: 20px;
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .card-title {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
        }

        /* 数据概览卡片 */
        .overview-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 20px;
        }

        .overview-card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 20px;
            text-align: center;
        }

        .overview-label {
            color: #64748b;
            font-size: 14px;
            margin-bottom: 8px;
        }

        .overview-value {
            font-size: 24px;
            font-weight: bold;
            color: #1e293b;
        }

        /* 核心指标卡片 */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-bottom: 20px;
        }

        .metric-card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 20px;
            text-align: center;
        }

        .metric-label {
            color: #64748b;
            font-size: 14px;
            margin-bottom: 8px;
        }

        .metric-value {
            font-size: 24px;
            font-weight: bold;
        }

        .metric-normal {
            color: #10b981;
        }

        .metric-warning {
            color: #f59e0b;
        }

        .metric-error {
            color: #ef4444;
        }

        /* 图表容器 */
        .chart-container {
            position: relative;
            height: 300px;
            width: 100%;
        }

        /* 表格样式 */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #e2e8f0;
        }

        th {
            background-color: #f1f5f9;
            font-weight: 600;
            color: #1e293b;
        }

        tr:hover {
            background-color: #f8fafc;
        }

        /* 按钮样式 */
        .btn {
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            border: none;
        }

        .btn-primary {
            background-color: #2563eb;
            color: white;
        }

        .btn-outline {
            background-color: transparent;
            border: 1px solid #cbd5e1;
            color: #64748b;
        }

        /* 下拉菜单 */
        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: white;
            min-width: 160px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.1);
            z-index: 1;
            border-radius: 4px;
            right: 0;
            top: 100%;
        }

        .dropdown-content a {
            color: #1e293b;
            padding: 12px 16px;
            text-decoration: none;
            display: block;
        }

        .dropdown-content a:hover {
            background-color: #f1f5f9;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }

        /* 响应式 */
        @media (max-width: 1200px) {
            .overview-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .metrics-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 768px) {
            .overview-grid {
                grid-template-columns: 1fr;
            }
            
            .metrics-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="top-nav">
        <div class="logo">管理系统</div>
        <div class="user-info">
            <div class="notification-icon">🔔</div>
            <div class="user-dropdown">
                <span>管理员 ▼</span>
                <div class="dropdown-content">
                    <a href="#">个人设置</a>
                    <a href="#">退出登录</a>
                </div>
            </div>
        </div>
    </div>

    <!-- 主体布局 -->
    <div class="main-container">
        <!-- 左侧菜单栏 -->
        <div class="sidebar" id="sidebar">
            <div class="menu-toggle" onclick="toggleSidebar()">☰ 菜单</div>
            <div class="menu-items">
                <div class="menu-item active">
                    <a href="./index.html">
                        <span>📊</span>
                        <span class="menu-text">仪表盘</span>
                    </a>
                  
                </div>
                <div class="menu-item">
                    <a href="./dianpu.html">
                        <span>🏪</span>
                        <span class="menu-text">店铺管理</span>
                    </a>
                   
                </div>
                <div class="menu-item">
                    <a href="./jiqiren.html">
                        <span>🤖</span>
                        <span class="menu-text">机器人管理</span>
                    </a>
                 
                </div>
                <div class="menu-item">
                    <a href="./order.html">
                        <span>📋</span>
                        <span class="menu-text">订单管理</span>
                    </a>
                   
                </div>
                <div class="menu-item ">
                    <span>👥</span>
                    <span class="menu-text">用户会员管理</span>
                    <span>▶</span>
                </div>
                <div class="submenu">
                    <div class="submenu-item">
                        <a href="./user.html">
                            <span>├─</span>
                            <span class="menu-text">用户会员列表</span>
                        </a>
                      
                    </div>
                    <div class="submenu-item active">
                        <a href="./vip.html">
                            <span>├─</span>
                            <span class="menu-text">会员等级配置</span>
                        </a>
                        
                    </div>
                </div>
                <div class="menu-item ">
                    <a href="./fuwu.html">
                        <span>🎯</span>
                        <span class="menu-text">服务套餐类型</span>
                    </a>
                </div>
                <div class="menu-item">
                    <span>🎯</span>
                    <span class="menu-text">促销管理(二期)</span>
                </div>
                <div class="menu-item">
                    <span>📈</span>
                    <span class="menu-text">数据统计(二期)</span>
                </div>
                <div class="menu-item">
                    <span>⚙️</span>
                    <span class="menu-text">系统设置</span>
                </div>
            </div>
        </div>

        <!-- 中间内容区 -->
        <div class="content">
            <!-- 数据概览卡片 -->
            <div class="overview-grid">
                <div class="overview-card" onclick="navigateToOrders('today')">
                    <div class="overview-label">今日订单</div>
                    <div class="overview-value" style="color: #ef4444;">128单</div>
                </div>
                <div class="overview-card">
                    <div class="overview-label">昨日订单</div>
                    <div class="overview-value">105单</div>
                </div>
                <div class="overview-card">
                    <div class="overview-label">本周订单</div>
                    <div class="overview-value">680单</div>
                </div>
                <div class="overview-card">
                    <div class="overview-label">本月订单</div>
                    <div class="overview-value">2560单</div>
                </div>
            </div>

            <!-- 核心指标卡片 -->
            <div class="metrics-grid">
                <div class="metric-card">
                    <div class="metric-label">活跃店铺</div>
                    <div class="metric-value metric-normal">86家</div>
                </div>
                <div class="metric-card">
                    <div class="metric-label">在线机器人</div>
                    <div class="metric-value metric-normal">215台</div>
                </div>
                <div class="metric-card">
                    <div class="metric-label">每天新增用户</div>
                    <div class="metric-value metric-warning">98人</div>
                </div>
            </div>

            <!-- 订单趋势图 -->
            <div class="card">
                <div class="card-header">
                    <div class="card-title">近7日订单量趋势</div>
                    <div class="dropdown">
                        <button class="btn btn-outline">▼ 导出数据</button>
                        <div class="dropdown-content">
                            <a href="#">导出为Excel</a>
                            <a href="#">导出为CSV</a>
                        </div>
                    </div>
                </div>
                <div class="chart-container">
                    <canvas id="orderChart"></canvas>
                </div>
            </div>

            <!-- 店铺业绩TOP5 -->
            <div class="card">
                <div class="card-header">
                    <div class="card-title">店铺业绩排行（今日）</div>
                    <button class="btn btn-outline" onclick="viewAllStores()">查看全部</button>
                </div>
                <div class="table-container">
                    <table>
                        <thead>
                            <tr>
                                <th>排名</th>
                                <th>店铺名</th>
                                <th>订单量</th>
                                <th>营收</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>1</td>
                                <td>朝阳店</td>
                                <td>28单</td>
                                <td>1568元</td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>海淀店</td>
                                <td>22单</td>
                                <td>1240元</td>
                            </tr>
                            <tr>
                                <td>3</td>
                                <td>西城店</td>
                                <td>19单</td>
                                <td>1064元</td>
                            </tr>
                            <tr>
                                <td>4</td>
                                <td>东城店</td>
                                <td>17单</td>
                                <td>952元</td>
                            </tr>
                            <tr>
                                <td>5</td>
                                <td>丰台店</td>
                                <td>15单</td>
                                <td>840元</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 切换侧边栏
        function toggleSidebar() {
            const sidebar = document.getElementById('sidebar');
            sidebar.classList.toggle('collapsed');
        }

        // 导航到订单页面
        function navigateToOrders(type) {
            alert(`跳转到${type === 'today' ? '今日' : '昨日'}订单列表`);
        }

        // 查看所有店铺
        function viewAllStores() {
            alert('跳转到店铺管理 - 业绩排行页面');
        }

        // 初始化图表
        document.addEventListener('DOMContentLoaded', function() {
            const ctx = document.getElementById('orderChart').getContext('2d');
            const orderChart = new Chart(ctx, {
                type: 'line',
                data: {
                    labels: ['1月1日', '1月2日', '1月3日', '1月4日', '1月5日', '1月6日', '1月7日'],
                    datasets: [{
                        label: '订单量',
                        data: [85, 92, 78, 105, 128, 115, 98],
                        borderColor: '#2563eb',
                        backgroundColor: 'rgba(37, 99, 235, 0.1)',
                        tension: 0.4,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });
        });

        // 菜单点击事件
        document.querySelectorAll('.menu-item').forEach(item => {
            item.addEventListener('click', function() {
                document.querySelectorAll('.menu-item').forEach(i => i.classList.remove('active'));
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>